# coding=utf-8
def main(s1=None, s2=None):
    m = len(s1)
    n = len(s2)
    if m >= n:
        s = ''
        for i in range(m):
            s = s1[i:n+i:]+s1[:(n+i)%m if n+i>m else 0:]
            if s == s2:
                return True

        return False

    return False

if __name__ == '__main__':
    while 1:
        s1 = raw_input('input base string:')
        s2 = raw_input('input sub string:')
        if not s1 and not s2:
            break
        print main(s1, s2)
        raw_input()
        import os
        os.system('cls')


